﻿namespace Forms
{
    using Forms.My;

    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;

    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class frmPfade : Form
    {
        [AccessedThroughProperty("butDatenbankpfad")]
        private Button _butDatenbankpfad;
        [AccessedThroughProperty("butImportpfad")]
        private Button _butImportpfad;
        [AccessedThroughProperty("butOk")]
        private Button _butOk;
        [AccessedThroughProperty("butSicherungspfad")]
        private Button _butSicherungspfad;
        [AccessedThroughProperty("chkSichern")]
        private CheckBox _chkSichern;
        [AccessedThroughProperty("chkTAPool")]
        private CheckBox _chkTAPool;
        [AccessedThroughProperty("FolderBrowserDialog")]
        private System.Windows.Forms.FolderBrowserDialog _FolderBrowserDialog;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("GroupBox2")]
        private GroupBox _GroupBox2;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("txtAppPfad")]
        private TextBox _txtAppPfad;
        [AccessedThroughProperty("txtDatenbankpfad")]
        private TextBox _txtDatenbankpfad;
        [AccessedThroughProperty("txtImportpfad")]
        private TextBox _txtImportpfad;
        [AccessedThroughProperty("txtSicherungspfad")]
        private TextBox _txtSicherungspfad;
        private string TestPfadAenderung;

        [DebuggerNonUserCode]
        public frmPfade()
        {
            base.Load += new EventHandler(this.frmPfade_Load);
            base.FormClosing += new FormClosingEventHandler(this.frmPfade_Closing);
            this.InitializeComponent();
        }

        private void butDatenbankpfad_Click(object sender, EventArgs e)
        {
            this.FolderBrowserDialog.Description = "Bitte wählen Sie den Datenbankpfad aus:";
            this.FolderBrowserDialog.SelectedPath = this.txtDatenbankpfad.Text;
            if (this.FolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtDatenbankpfad.Text = this.FolderBrowserDialog.SelectedPath;
            }
        }

        private void butImportpfad_Click(object sender, EventArgs e)
        {
            this.FolderBrowserDialog.Description = "Bitte wählen Sie den Importpfad aus:";
            this.FolderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
            this.FolderBrowserDialog.SelectedPath = this.txtImportpfad.Text;
            if (this.FolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtImportpfad.Text = this.FolderBrowserDialog.SelectedPath;
            }
        }

        private void butOk_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void butSicherungspfad_Click(object sender, EventArgs e)
        {
            this.FolderBrowserDialog.Description = "Bitte wählen Sie den Sicherungspfad für die Import-Dateien aus:";
            this.FolderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
            this.FolderBrowserDialog.SelectedPath = this.txtSicherungspfad.Text;
            if (this.FolderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.txtSicherungspfad.Text = this.FolderBrowserDialog.SelectedPath;
            }
        }

        private void chkSichern_CheckedChanged(object sender, EventArgs e)
        {
            if (this.chkSichern.Checked)
            {
                this.txtSicherungspfad.Enabled = true;
                this.butSicherungspfad.Enabled = true;
            }
            else
            {
                this.txtSicherungspfad.Enabled = false;
                this.butSicherungspfad.Enabled = false;
            }
        }


        private void frmPfade_Closing(object sender, FormClosingEventArgs e)
        {
            if (!(File.Exists(MySettings.MySettingsProperty.DatabasePath + @"\amDataBase.xml") | File.Exists(MySettings.MySettingsProperty.DatabasePath + @"\amDataBase.locked")))
            {
                if (Interaction.MsgBox("Im angegebenen Datenbankpfad existiert keine Datendatei. Wollen Sie eine anlegen?", MsgBoxStyle.Question | MsgBoxStyle.YesNo, "Datenbankpfad") == MsgBoxResult.Yes)
                {
                    this.DialogResult = DialogResult.Retry;
                    e.Cancel = false;
                }
                else
                {
                    ProjectData.EndApp();
                }
            }
            else
            {
                if ((this.TestPfadAenderung != MySettings.MySettingsProperty.DatabasePath) & File.Exists(MySettings.MySettingsProperty.DatabasePath + @"\amDataBase.xml"))
                {
                    MyProject.Forms.Main.cs.SessionLoad();
                }
                e.Cancel = false;
                // save settings
                MySettings.MySettingsProperty.Save();

                this.DialogResult = DialogResult.OK;
            }
            if (!Directory.Exists(MySettings.MySettingsProperty.FilesPath))
            {
                Interaction.MsgBox("Der angegebene Importpfad ist nicht vorhanden. Bitte geben Sie einen korrekten Importpfad an.", MsgBoxStyle.Exclamation, "Pfad existiert nicht");
                e.Cancel = true;
            }
            if (!Directory.Exists(MySettings.MySettingsProperty.FilesBackupPath) && MySettings.MySettingsProperty.DoBackup)
            {
                Interaction.MsgBox("Der angegebene Sicherungspfad ist nicht vorhanden. Bitte geben Sie einen korrekten Sicherungpfad an oder deaktivieren Sie die automatische Sicherung.", MsgBoxStyle.Exclamation, "Pfad existiert nicht");
                e.Cancel = true;
            }
        }

        private void frmPfade_Load(object sender, EventArgs e)
        {
            this.chkTAPool.DataBindings.Clear();

            this.chkTAPool.Checked = MySettings.MySettingsProperty.UseTAPool; 
            //DataBindings.Add("Checked", MySettings.MySettingsProperty., "UseTAPool");
            this.TestPfadAenderung = MySettings.MySettingsProperty.DatabasePath;
            if (this.chkSichern.Checked)
            {
                this.txtSicherungspfad.Enabled = true;
                this.butSicherungspfad.Enabled = true;
            }
            else
            {
                this.txtSicherungspfad.Enabled = false;
                this.butSicherungspfad.Enabled = false;
            }
            if (File.Exists(MySettings.MySettingsProperty.DatabasePath + @"\amDataBase.xml") | File.Exists(MySettings.MySettingsProperty.DatabasePath + @"\amDataBase.locked"))
            {
                MyProject.Forms.Main.cs.SessionSave();
                MyProject.Forms.Main.cs.SessionLoad();
            }
            this.txtAppPfad.Text = MyProject.Application.Info.DirectoryPath;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            this.Label1 = new Label();
            this.Label2 = new Label();
            this.Label3 = new Label();
            this.butDatenbankpfad = new Button();
            this.butImportpfad = new Button();
            this.butSicherungspfad = new Button();
            this.butOk = new Button();
            this.FolderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
            this.Label4 = new Label();
            this.txtAppPfad = new TextBox();
            this.txtSicherungspfad = new TextBox();
            this.chkSichern = new CheckBox();
            this.txtImportpfad = new TextBox();
            this.txtDatenbankpfad = new TextBox();
            this.GroupBox1 = new GroupBox();
            this.GroupBox2 = new GroupBox();
            this.chkTAPool = new CheckBox();
            this.GroupBox1.SuspendLayout();
            this.GroupBox2.SuspendLayout();
            this.SuspendLayout();
            this.Label1.AutoSize = true;
            Point point = new Point(0x2d, 130);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            Size size = new Size(0x39, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 1;
            this.Label1.Text = "Importpfad";
            this.Label2.AutoSize = true;
            point = new Point(0x15, 0xc5);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x51, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 2;
            this.Label2.Text = "Sicherungspfad";
            this.Label3.AutoSize = true;
            point = new Point(0x15, 80);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x51, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 3;
            this.Label3.Text = "Datenbankpfad";
            point = new Point(0x1b1, 0x4b);
            this.butDatenbankpfad.Location = point;
            this.butDatenbankpfad.Name = "butDatenbankpfad";
            size = new Size(0x1c, 0x16);
            this.butDatenbankpfad.Size = size;
            this.butDatenbankpfad.TabIndex = 7;
            this.butDatenbankpfad.Text = "...";
            this.butDatenbankpfad.UseVisualStyleBackColor = true;
            point = new Point(0x1b1, 0x7d);
            this.butImportpfad.Location = point;
            this.butImportpfad.Name = "butImportpfad";
            size = new Size(0x1c, 0x16);
            this.butImportpfad.Size = size;
            this.butImportpfad.TabIndex = 8;
            this.butImportpfad.Text = "...";
            this.butImportpfad.UseVisualStyleBackColor = true;
            point = new Point(0x1b1, 0xc0);
            this.butSicherungspfad.Location = point;
            this.butSicherungspfad.Name = "butSicherungspfad";
            size = new Size(0x1c, 0x16);
            this.butSicherungspfad.Size = size;
            this.butSicherungspfad.TabIndex = 9;
            this.butSicherungspfad.Text = "...";
            this.butSicherungspfad.UseVisualStyleBackColor = true;
            point = new Point(0x196, 0x187);
            this.butOk.Location = point;
            this.butOk.Name = "butOk";
            size = new Size(0x71, 0x1b);
            this.butOk.Size = size;
            this.butOk.TabIndex = 10;
            this.butOk.Text = "Ok";
            this.butOk.UseVisualStyleBackColor = true;
            this.Label4.AutoSize = true;
            point = new Point(0x15, 0x21);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x4b, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 12;
            this.Label4.Text = "Programmpfad";
            point = new Point(0x6c, 30);
            this.txtAppPfad.Location = point;
            this.txtAppPfad.Name = "txtAppPfad";
            this.txtAppPfad.ReadOnly = true;
            size = new Size(0x13f, 20);
            this.txtAppPfad.Size = size;
            this.txtAppPfad.TabIndex = 11;
            this.txtAppPfad.Text = MySettings.MySettingsProperty.DatabasePath;
            this.txtSicherungspfad.DataBindings.Add(new Binding("Text", MySettings.MySettingsProperty, "FilesBackupPath", true, DataSourceUpdateMode.OnPropertyChanged));
            point = new Point(0x6c, 0xc2);
            this.txtSicherungspfad.Location = point;
            this.txtSicherungspfad.Name = "txtSicherungspfad";
            size = new Size(0x13f, 20);
            this.txtSicherungspfad.Size = size;
            this.txtSicherungspfad.TabIndex = 6;
            this.txtSicherungspfad.Text = MySettings.MySettingsProperty.FilesBackupPath;
            this.chkSichern.AutoSize = true;
            this.chkSichern.Checked = MySettings.MySettingsProperty.DoBackup;
            this.chkSichern.CheckState = CheckState.Checked;
            this.chkSichern.DataBindings.Add(new Binding("Checked", MySettings.MySettingsProperty, "DoBackup", true, DataSourceUpdateMode.OnPropertyChanged));
            point = new Point(0x6c, 0xab);
            this.chkSichern.Location = point;
            this.chkSichern.Name = "chkSichern";
            size = new Size(0x126, 0x11);
            this.chkSichern.Size = size;
            this.chkSichern.TabIndex = 5;
            this.chkSichern.Text = "Dateien nach dem Import in Sicherungspfad verschieben";
            this.chkSichern.UseVisualStyleBackColor = true;
            this.txtImportpfad.DataBindings.Add(new Binding("Text", MySettings.MySettingsProperty, "FilesPath", true, DataSourceUpdateMode.OnPropertyChanged));
            point = new Point(0x6c, 0x7f);
            this.txtImportpfad.Location = point;
            this.txtImportpfad.Name = "txtImportpfad";
            size = new Size(0x13f, 20);
            this.txtImportpfad.Size = size;
            this.txtImportpfad.TabIndex = 4;
            this.txtImportpfad.Text = MySettings.MySettingsProperty.FilesPath;
            this.txtDatenbankpfad.DataBindings.Add(new Binding("Text", MySettings.MySettingsProperty, "DatabasePath", true, DataSourceUpdateMode.OnPropertyChanged));
            point = new Point(0x6c, 0x4d);
            this.txtDatenbankpfad.Location = point;
            this.txtDatenbankpfad.Name = "txtDatenbankpfad";
            size = new Size(0x13f, 20);
            this.txtDatenbankpfad.Size = size;
            this.txtDatenbankpfad.TabIndex = 0;
            this.txtDatenbankpfad.Text = MySettings.MySettingsProperty.DatabasePath;
            this.GroupBox1.Controls.Add(this.txtAppPfad);
            this.GroupBox1.Controls.Add(this.Label4);
            this.GroupBox1.Controls.Add(this.txtDatenbankpfad);
            this.GroupBox1.Controls.Add(this.Label1);
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.butSicherungspfad);
            this.GroupBox1.Controls.Add(this.Label3);
            this.GroupBox1.Controls.Add(this.butImportpfad);
            this.GroupBox1.Controls.Add(this.txtImportpfad);
            this.GroupBox1.Controls.Add(this.butDatenbankpfad);
            this.GroupBox1.Controls.Add(this.chkSichern);
            this.GroupBox1.Controls.Add(this.txtSicherungspfad);
            point = new Point(0x18, 0x7c);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            size = new Size(0x1ef, 0xe3);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 13;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "Pfade";
            this.GroupBox2.Controls.Add(this.chkTAPool);
            point = new Point(0x18, 0x19);
            this.GroupBox2.Location = point;
            this.GroupBox2.Name = "GroupBox2";
            size = new Size(0x1ef, 0x4a);
            this.GroupBox2.Size = size;
            this.GroupBox2.TabIndex = 14;
            this.GroupBox2.TabStop = false;
            this.GroupBox2.Text = "BMW Bank allgemein";
            this.chkTAPool.AutoSize = true;
            point = new Point(0x18, 0x21);
            this.chkTAPool.Location = point;
            this.chkTAPool.Name = "chkTAPool";
            size = new Size(130, 0x11);
            this.chkTAPool.Size = size;
            this.chkTAPool.TabIndex = 0;
            this.chkTAPool.Text = "\x00dcber TA-Pool ablösen";
            this.chkTAPool.UseVisualStyleBackColor = true;
            this.AcceptButton = this.butOk;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x227, 0x1ce);
            this.ClientSize = size;
            this.Controls.Add(this.GroupBox2);
            this.Controls.Add(this.GroupBox1);
            this.Controls.Add(this.butOk);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "frmPfade";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "Einstellungen allgemein";
            this.TopMost = true;
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.GroupBox2.ResumeLayout(false);
            this.GroupBox2.PerformLayout();
            this.ResumeLayout(false);
        }

        internal virtual Button butDatenbankpfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._butDatenbankpfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.butDatenbankpfad_Click);
                if (this._butDatenbankpfad != null)
                {
                    this._butDatenbankpfad.Click -= handler;
                }
                this._butDatenbankpfad = value;
                if (this._butDatenbankpfad != null)
                {
                    this._butDatenbankpfad.Click += handler;
                }
            }
        }

        internal virtual Button butImportpfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._butImportpfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.butImportpfad_Click);
                if (this._butImportpfad != null)
                {
                    this._butImportpfad.Click -= handler;
                }
                this._butImportpfad = value;
                if (this._butImportpfad != null)
                {
                    this._butImportpfad.Click += handler;
                }
            }
        }

        internal virtual Button butOk
        {
            [DebuggerNonUserCode]
            get
            {
                return this._butOk;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.butOk_Click);
                if (this._butOk != null)
                {
                    this._butOk.Click -= handler;
                }
                this._butOk = value;
                if (this._butOk != null)
                {
                    this._butOk.Click += handler;
                }
            }
        }

        internal virtual Button butSicherungspfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._butSicherungspfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.butSicherungspfad_Click);
                if (this._butSicherungspfad != null)
                {
                    this._butSicherungspfad.Click -= handler;
                }
                this._butSicherungspfad = value;
                if (this._butSicherungspfad != null)
                {
                    this._butSicherungspfad.Click += handler;
                }
            }
        }

        internal virtual CheckBox chkSichern
        {
            [DebuggerNonUserCode]
            get
            {
                return this._chkSichern;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.chkSichern_CheckedChanged);
                if (this._chkSichern != null)
                {
                    this._chkSichern.CheckedChanged -= handler;
                }
                this._chkSichern = value;
                if (this._chkSichern != null)
                {
                    this._chkSichern.CheckedChanged += handler;
                }
            }
        }

        internal virtual CheckBox chkTAPool
        {
            [DebuggerNonUserCode]
            get
            {
                return this._chkTAPool;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._chkTAPool = value;
            }
        }

        internal virtual System.Windows.Forms.FolderBrowserDialog FolderBrowserDialog
        {
            [DebuggerNonUserCode]
            get
            {
                return this._FolderBrowserDialog;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._FolderBrowserDialog = value;
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual GroupBox GroupBox2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox2 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual TextBox txtAppPfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtAppPfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtAppPfad = value;
            }
        }

        internal virtual TextBox txtDatenbankpfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtDatenbankpfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtDatenbankpfad = value;
            }
        }

        internal virtual TextBox txtImportpfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtImportpfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtImportpfad = value;
            }
        }

        internal virtual TextBox txtSicherungspfad
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtSicherungspfad;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtSicherungspfad = value;
            }
        }
    }
}

